<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>利润提现</title>
	<link rel="stylesheet" href="css/amazeui.min.css" />
	<link rel="stylesheet" href="css/app.css" />
	<link rel="stylesheet" href="css/swiper-3.3.1.min.css" />
	<script src="js/amazeui.min.js" type="text/javascript"></script>
	<script src="js/jquery.min.js" type="text/javascript"></script>
	<style>
		body {
			max-width: 640px;
			margin: 0 auto;
			font-size: 10px;
			background: #F2F3F8;
		}

		* {
			box-sizing: border-box;
		}

		[class*=am-u-] {
			padding: 0;
		}
	</style>
</head>

<body>
	<!--头部-->
	<header class="am-u">
		<div class="am-u-sm-12 head_nav" style="margin:0;">
			<div class="am-u-sm-2 am-vertical-align" style="text-align: center;">
				<a href="profits.html">
					<img src="img/return@2x.png" class="am-vertical-align-middle" alt="" />
				</a>
			</div>
			<div class="am-u-sm-8 head_text">
				利润提现
			</div>
			<div class="am-u-sm-2" style="color: #fff;font-size: 13px;text-align: center;">

			</div>
		</div>
	</header>
	<div style="clear: both;"></div>
	<div style="padding: 20px 10px 10px;border-radius: 5px;">
		<div class="am-u">
			<div style="padding:7px;background: #CECDD2;font-size: 15px;text-align: center;border-top-left-radius:10px;border-top-right-radius:10px;">
				<span style=" display: block;color: #41A0F0;">请确认</span>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：
				</div>
				<div id="accountName" class="am-u-sm-9" style="font-size: 13px;">
					但是是
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					会员等级：
				</div>
				<div id="level_name" class="am-u-sm-9" style="font-size: 13px;">
					普通会员
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					身份证号：
				</div>
				<div id="idCard" class="am-u-sm-9" style="font-size: 13px;">

				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					取现金额：
				</div>
				<div id="amount" class="am-u-sm-9" style="font-size: 13px;color:#0567CD">
					¥1000.00
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					手&nbsp;&nbsp;续&nbsp;&nbsp;费：
				</div>
				<div id="fee" class="am-u-sm-9" style="font-size: 13px;color:#0567CD">
					¥1
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					到账金额：
				</div>
				<div id="trueamount" class="am-u-sm-9" style="font-size: 13px;color:#0567CD">
					¥-1
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					结算卡号：
				</div>
				<div id="accountNo" class="am-u-sm-9" style="font-size: 13px;">
					（null）
				</div>
			</div>
			<div class="am-u-sm-12 " style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-3" style="font-size: 13px;text-align: center;">
					所属银行：
				</div>
				<div id="bankName" class="am-u-sm-9" style="font-size: 13px;">

				</div>
			</div>
			<div class="am-u-sm-12 am-vertical-align" style="padding: 5px 0px 5px 0px;background: #fff;">
				<div class="am-u-sm-8" style="font-size: 13px;padding-left: 5%;">
					<input id="code" placeholder="请输入验证码" type="text" style="border-radius: 5px;width: 91%;" />
				</div>
				<div class="am-u-sm-4" style="font-size: 13px;text-align: left;">
					<button id="huoqu_btn" type="button" style="border: none;background: #fff;color: #0567CD;border:1px solid #0567CD;">发送验证码</button>
				</div>
			</div>
		</div>
		<div>
			<button id="queren_btn" type="button" class="am-btn" style="width: 100%;background: #0567CD;color: #fff;border-bottom-right-radius:10px;border-bottom-left-radius:10px;">确 认</button>
		</div>
	</div>
	<div id="remind" style="padding:1rem;color:red;"></div>
	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/loading.js"></script>
	<script>
		var method1 = "withdrawview";
		var token1 = sessionStorage['token'];
		var phone1 = sessionStorage["login_name"];
		$.ajax({
			type: 'POST',
			url: "http://www.rice.com/app/api/h5_access",
			datatype: "JSON",
			data: {
				method: method1,
				token: token1
			},
			success: function (data) {
				var data1 = JSON.parse(data);
				if (data1.status === 1) {
					$("#accountName").html(data1.data.accountName);
					$("#level_name").html(data1.data.level_name);
					$("#idCard").html(data1.data.idCard);
					$("#amount").html(data1.data.amount);
					$('#fee').html(data1.data.fee);
					$('#trueamount').html(data1.data.trueamount);
					$("#accountNo").html(data1.data.accountNo);
					$("#bankName").html(data1.data.bankName);
					$('#remind').html(data1.data.remind);
				} else if (Number(data1.status) == 2) {
					alert(data1.message);
					window.location.href = "login.html";
				} else {
					alert(data1.message);
				}
			}
		});
		$("#huoqu_btn").on("click", function () {
			method1 = "withdraw_sendmsg";
			$.ajax({
				type: 'POST',
				url: "http://www.rice.com/app/api/h5_access",
				contentType: "application/x-www-form-urlencoded; charset=utf-8",
				datatype: "JSON",
				data: {
					method: method1,
					phone: phone1
				},
				success: function (data) {
					var data1 = JSON.parse(data);
					console.log(data);
					if (data1.status === 1) {
						var time = 180;
						$('#huoqu_btn').html(time + "秒后重发").attr('disabled', true);
						setInterval(function () {
							time--;
							if (time === 0) {
								$('#huoqu_btn').html("发送验证码").attr('disabled', false);

							} else if (time > 0) {
								$('#huoqu_btn').html(time + "秒后重发").attr('disabled', true);
							}

						}, 1000);
					} else if (Number(data1.status) == 2) {
						alert(data1.message);
						window.location.href = "login.html";
					} else {
						alert(data1.message);
					}
				}
			});
		})

		$("#queren_btn").on("click", function () {
			method1 = "withdrawcash";
			var code1 = $("#code").val();
			var amount1 = $("#amount").html();
			if (code1 == "" || code1 == null) {
				alert("请输入验证码");
				return false;
			}
			$.ajax({
				type: 'POST',
				url: "http://www.rice.com/app/api/h5_access",
				contentType: "application/x-www-form-urlencoded; charset=utf-8",
				datatype: "JSON",
				data: {
					method: method1,
					token: token1,
					amount: amount1,
					code: code1
				},
				success: function (data) {
					var data1 = JSON.parse(data);
					console.log(data);
					if (data1.status === 1) {
						alert(data1.message);

						window.location.href = "profits.html";
					} else if (Number(data1.status) == 2) {
						alert(data1.message);
						window.location.href = "login.html";
					} else {
						alert(data1.message);
					}
				}
			});
		})
	</script>
</body>

</html>